<?php
$dirname = dirname(__FILE__);
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
include $dirname.'/alias.php';

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'驴友村',
	'language' => 'zh_cn',
	'timezone' => 'PRC',

	// preloading 'log' component
	'preload'=>array('log', 'linkageSelector', 'ucClient'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.marrays.*',
		'application.services.*',
		'application.components.*',
		'application.components.ui.*',
		'application.components.autoForm.*',
		'application.components.search.*',
		'application.modules.admin.models.*',
		'application.modules.admin.components.*',
		'application.modules.admin.components.ui.*',
		'lib.widgets.CActiveFormAdv',
		'lib.helpers.utils.CUtilHelper',
		'lib.helpers.CControllerHelper',
		'lib.components.CDataToken',
		'application.pinyin.*',
	),

	'modules' => include $dirname.'/modules.php',
	'controllerMap' => array(
		'xhUpload' => array(
			'class' => 'CXhUoloadController',
		),
	),
	// application components
	'components'=>array(
		'ucClient' => array(
			'class' => 'application.components.UCClient',
			'clientPath' => 'interface/uc',
		),
		'option' => array(
			'class' => 'application.components.Option',
		),
		'user'=>array(
			'class' => 'WebUser',
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		'img' => array(
			'class' => 'lib.components.CImageOutput2',
			'configFile' => 'application.config.image',
		),
		'adminUser' => array(
			'class' => 'admin.components.AdminUser',
			'loginUrl' => '/admin/default/login',
			'behaviors' => array(
				'syncUser' => 'coms.behaviors.SyncUserBehavior', 
			),
		),
		'autoForm' => array(
			'class' => 'application.components.autoForm.AutoForm',
		),
		// uncomment the following to enable URLs in path-format

		'enum' => array(
			'class' => 'lib.components.CEnumer',
			'lang' => 'zh_cn',
		),

		'linkageSelector' => array(
			'class' => 'lib.components.linkage.CLinkageSelectorHandler',
		),
		'mailer' => array(
		    'class' => 'ext.swiftMailer.SwiftMailer',
		    // For SMTP
		    'mailer' => 'smtp',
		),
        'findPwd'=>array(
			'class' => 'coms.FindPwd',
			'memberModel' => 'MemberAccount',
			'memberNameAttr' => 'worker_name',
			'emailAttr' => 'profile.email',
			'criteria' => array(
				'with' => array('profile')
			),
		),

		'config' => array(
			'class' => 'lib.helpers.CConfigReader',
		),
		
		'cache' => array(
			'class' => 'CFileCache'
		),

		'pay' => include $dirname.'/pay.php',

		'urlManager'=>array(
			'class' => 'UrlManager',
			'urlFormat'=>'path',
			'showScriptName' => false,
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),

		// uncomment the following to use a MySQL database
		'db'=>include $dirname.'/db.php',
		'errorHandler'=>array(
			'class' => 'ErrorHandler',
			// use 'site/error' action to display errors
			'specialErrorActions' => array(
				'admin/' => '/admin/default/error',
			),
			'errorAction' => 'misc/error404',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
//				array(
//					'class'=>'CFileLogRoute',
//					'levels'=>'error, warning',
//				),
//				array(
//					'class' => 'lib.ext.yii-debug-toolbar.YiiDebugToolbarRoute',
//					'levels'=>'error, warning',
//				),
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=> include $dirname.'/params.php',
	'timeZone'=>'Asia/Shanghai',
	'charset'=>'utf-8',
	'defaultController' => 'provide/index',	
);